
import { Entity, PrimaryUuid, Cover, MemberId, CreateDate, UpdateDate, Openid, Price, Remark, Title, DateTime, ShopGoods, AddressDetail, Code, ShopOrderStatus, PayType, Unique, Uuid } from '@sker/core'
@Entity({
    name: 'shop_order'
})
@Unique('UK_WX_PAYMENT_LOG_ORDERSN', [`ordersn`])
export class ShopOrder {
    static title: string = `订单`;
    static resource: string = `shop_order`;

    @PrimaryUuid({
        primaryKeyConstraintName: "PK_SHOP_ORDER_ID"
    })
    id!: string;

    @Openid()
    openid!: string;

    @MemberId()
    member_id!: string;

    @Code({ comment: '订单编号' })
    ordersn!: string;

    @Price({ comment: '订单总价' })
    price!: number;

    @Price({ comment: '折扣金额' })
    discountprice​!: number;

    @ShopOrderStatus({
        comment: '订单状态：0=待付款，1=待发货，2=待收货，3=已完成，4=已取消，5=申请退款，6=已退款'
    })
    status!: string;

    @PayType({ nullable: true, comment: '支付方式：0=未支付，1=微信支付，2=余额支付' })
    paytype!: number;

    @Cover({ nullable: true, default: '', comment: '合同图片' })
    paper: string;

    @Code({ nullable: true, default: 'good' })
    type: string;

    @Code({ comment: '物流单号', nullable: true, default: '' })
    transid!: string;

    @Code({ comment: '物流名称', nullable: true, default: '' })
    transname!: string;

    @Code({ comment: '微信退款单号', nullable: true, default: '' })
    refundid!: string;

    @Code({ comment: '取货码', nullable: true, default: '' })
    code!: string;

    @AddressDetail({ comment: '收货地址，JSON 格式', nullable: true, default: {} })
    address!: any;

    @ShopGoods({ comment: '订单商品, JSON 格式', nullable: true, default: [] })
    goods!: any;

    @Remark({ comment: '备注', nullable: true, default: '' })
    remark!: string;

    @DateTime({ comment: '支付时间', nullable: true, })
    paytime!: Date;

    @DateTime({ comment: '发货时间', nullable: true, })
    sendtime!: Date;

    @DateTime({ comment: '完成时间', nullable: true, })
    finishtime!: Date;

    @DateTime({ comment: '退款时间', nullable: true, })
    refundtime: Date;

    @CreateDate({
        comment: '创建日期'
    })
    create_date!: Date;

    @UpdateDate({
        comment: '更新日期'
    })
    update_date!: Date;

    @Uuid({ nullable: true })
    company_id: string;

    @Uuid({ nullable: true, comment: '父订单' })
    parent_id: string;

    @Uuid({nullable: true})
    provider_id: string;
}
